package com.xxf.basemvp.weakbase.weak

import android.os.Bundle
import android.support.v7.app.AppCompatActivity


/**
 * @author :XXF
 */
abstract class WeakActivity<V, P : WeakPresenter<V>> : AppCompatActivity(), BaseView<V, P> {
    protected var mPresenter: P? = null

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(getLayoutResId())
        //创建Prsenter
        mPresenter = createPresenter()
        initView()
    }

    override fun onDestroy() {
        destroyPresenter()

        super.onDestroy()
    }

    private fun destroyPresenter() {
        //解除关系
        mPresenter?.detachView()

    }


}
